package com.mew.common.rest.agent;

import com.mew.common.entity.user.Profile;
import com.mew.common.rest.MewResponse;
import com.mew.common.rest.user.UserMoneyResponseMessage;
import io.netty.buffer.ByteBuf;
import lombok.Data;
import lombok.ToString;

@Data
@ToString(callSuper = true)
public class AgentExtractResponse extends MewResponse<AgentExtractResponse> {
    private long allBonus;//总返利
    private long allExtract;//总提取
    private UserMoneyResponseMessage money;
    @Override
    public void write(ByteBuf b) {
        writeLong(b,allBonus);
        writeLong(b,allExtract);
        money.write(b);
    }

    @Override
    public AgentExtractResponse read(ByteBuf b) {
        return null;
    }

    public AgentExtractResponse buildBySuccessMessage(long allBonus, long allExtract, Profile profile){
        this.allBonus = allBonus;
        this.allExtract = allExtract;
        this.money =  new UserMoneyResponseMessage(profile);
        return this;
    }
}
